package com.lzs.bootsafety.business.logs.controller;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.lzs.bootsafety.business.logs.entity.SysOperLogs;
import com.lzs.bootsafety.business.logs.service.SysOperLogsService;
import com.lzs.bootsafety.common.base.controller.BaseController;
import com.lzs.bootsafety.common.util.Resu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author  zhanshi Liu
 * @date    2020/04/15
 * @website www.jhmsona.cn
 */
@RestController
@RequestMapping("/log/oper")
public class SysOperLogsController extends BaseController {
    @Autowired
    private SysOperLogsService sysOperLogsService;
    @GetMapping("/info")
    public Resu info(Long operId){
        SysOperLogs sysOperLogs = sysOperLogsService.getByPrimaryKey(operId);
        return Resu.suces().put("data",sysOperLogs);
    }
    @GetMapping("/list")
    public Resu list(@RequestParam("data") String data){
        SysOperLogs sysOperLogs =  JSON.parseObject(data,SysOperLogs.class);
        PageInfo<SysOperLogs> pageInfo = sysOperLogsService.selectOperList(sysOperLogs);
        return Resu.page(pageInfo.getList(),pageInfo.getTotal(),200);
    }
}
